﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Simple.Services;
using Simple.Services.System.QHSEViolationCategory.Models;

namespace Simple.WebApi.Controllers.System;

/// <summary>
/// 违章类别对应体系要素管理
/// </summary>
[Route("QHSEViolationCategoryHSE/[action]")]
[ApiController]
public class QHSEViolationCategoryHSEController : ControllerBase
{
    private readonly QHSEViolationCategoryHSEService _violationCategoryHSEService;

    public QHSEViolationCategoryHSEController(QHSEViolationCategoryHSEService violationCategoryHSEService)
    {
        _violationCategoryHSEService = violationCategoryHSEService;
    }
    /// <summary>
    /// 违章类别对应体系要素列表
    /// </summary>
    [CustomAuthorize("hdv_qhse_data")]
    [HttpGet]
    public async Task<AppResult> List()
    {
        List<QHSEViolationCategoryHSEModel> menus = await _violationCategoryHSEService.GetAsync();
        return AppResult.Status200OK(data: menus);
    }
    [HttpGet]
    [ValidateTimestampAndSignature]
    public async Task<AppResult> List1()
    {
        List<QHSEViolationCategoryHSEModel> menus = await _violationCategoryHSEService.GetAsync();
        return AppResult.Status200OK(data: menus);
    }
    /// <summary>
    /// 违章类别对应体系要素
    /// </summary>
    [HttpGet]
    [CustomAuthorize("hdv_qhse_data")]
    public async Task<AppResult> GetHSEResult([FromQuery]QHSEViolationCategoryHSEPageInputModel inputModel)
    {
         var data =  await _violationCategoryHSEService.GetResult(inputModel);
        return AppResult.Status200OK(data: data);
    }
    [HttpGet]
    [ValidateTimestampAndSignature]
    public async Task<AppResult> GetHSEResult1([FromQuery] QHSEViolationCategoryHSEPageInputModel inputModel)
    {
        var data = await _violationCategoryHSEService.GetResult(inputModel);
        return AppResult.Status200OK(data: data);
    }
}
